home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1997 #1 / Amiga Plus CD - 1997 - No. 01.iso / pd / programmierung / mesa-1.2.8 / nt / wmesadef.h < prev   
C/C++ Source or Header  |  1996-05-27  |  4KB  |  123 lines

  1. /* WMesaDef.h */
  2.  
  3.  
  4. #ifndef WMESADEF_H
  5. #define WMESADEF_H
  6. /*
  7. struct wmesa_context
  8. {
  9.     struct gl_context *gl_ctx;
  10.     HDC Compat_DC;            
  11.     HDC    hDC;
  12.     HBITMAP Old_Compat_BM,Compat_BM;
  13.     GLboolean db_flag;
  14.     GLboolean rgb_flag;
  15.     GLuint depth;
  16.     unsigned long pixel;
  17.     unsigned long clearpixel;
  18.     char *ScreenMem; // WinG memory
  19.     BITMAPINFO *IndexFormat;
  20.     HPALETTE hPal; // Current Palette
  21. };
  22.  
  23. */
  24. #define REDBITS        0x03
  25. #define REDSHIFT    0x00
  26. #define GREENBITS    0x03
  27. #define GREENSHIFT    0x03
  28. #define BLUEBITS    0x02
  29. #define BLUESHIFT    0x06
  30.  
  31.  
  32. typedef struct _dibSection{
  33.     HDC        hDC;
  34.     HANDLE    hFileMap;
  35.     BOOL    fFlushed;
  36.     LPVOID    base;
  37. }WMDIBSECTION, *PWMDIBSECTION;
  38.  
  39. typedef struct _wmesa_context{
  40.     struct gl_context *gl_ctx;    /* the main library context */
  41.     HWND                Window;
  42.     HDC                 hDC;
  43.     HPALETTE            hPalette;
  44.     HPALETTE            hOldPalette;
  45.     HPEN                hPen;
  46.     HPEN                hOldPen;
  47.     HCURSOR             hOldCursor;
  48.     COLORREF            crColor;
  49.     /* 3D projection stuff */
  50.     RECT                drawRect;
  51.     UINT                uiDIBoffset;
  52.     /* OpenGL stuff */
  53.     HPALETTE            hGLPalette;
  54.     GLuint                width;
  55.     GLuint                height;
  56.     GLuint                ScanWidth;
  57.     GLboolean            db_flag;    /* double buffered? */
  58.     GLboolean            rgb_flag;    /* RGB mode? */
  59.     GLuint                depth;        /* bits per pixel (1, 8, 24, etc) */
  60.     ULONG                pixel;    /* current color index or RGBA pixel value */
  61.     ULONG                clearpixel; /* pixel for clearing the color buffers */
  62.     PSTR                ScreenMem; // WinG memory
  63.     BITMAPINFO            *IndexFormat;
  64.     HPALETTE            hPal; // Current Palette
  65.     //PWINDOWSTRUCT     stuff
  66.     BITMAPINFO          bmi;
  67.     HBITMAP             hbmDIB;
  68.     HBITMAP             hOldBitmap;
  69.     HBITMAP                Old_Compat_BM;
  70.     HBITMAP                Compat_BM;            /* Bitmap for double buffering */
  71.     PBYTE               pbPixels;
  72.     int                 nColors;
  73.     BYTE                cColorBits;
  74.     WMDIBSECTION        dib;
  75. #ifdef PROFILE
  76.     MESAPROF    profile;
  77. #endif
  78. }wmesa_context, *PWMC;
  79.  
  80.  
  81. #define PAGE_FILE        0xffffffff
  82.  
  83.  
  84. char ColorMap16[] = {
  85. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  86. 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
  87. 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
  88. 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
  89. 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
  90. 0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,
  91. 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,
  92. 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
  93. 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
  94. 0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,
  95. 0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,
  96. 0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,
  97. 0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,
  98. 0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,
  99. 0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,
  100. 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
  101. 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
  102. 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
  103. 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
  104. 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
  105. 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,
  106. 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
  107. 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,
  108. 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
  109. 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  110. 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,
  111. 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
  112. 0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,
  113. 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,
  114. 0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,
  115. 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
  116. 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};
  117.  
  118.  
  119. #define BGR16(r,g,b)    ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(ColorMap16[g]) << 5)) | (((WORD)(BYTE)(ColorMap16[r])) << 10)))
  120. #define BGR24(r,g,b)    (((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16))) << 8)
  121. #define BGR32(r,g,b)    ((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16)))
  122.  
  123. #endif